#ifndef _D_LIST_H
#define _D_LIST_H

typedef int ElementType;

typedef struct D_ListNode
{
    ElementType data;
    struct D_ListNode *next;
    struct D_ListNode *prev;
} D_ListNode;

typedef struct D_List
{
    int len;
    D_ListNode *head;
} D_List;

extern inline int IsEmpty(D_List *list);

extern D_List *InitList();

extern void Insert_Front(D_List* list, ElementType data);

extern void Insert_Back(D_List *list, ElementType data);

extern void Insert_Before(D_List *list, ElementType findData, ElementType data);

extern void Insert_After(D_List *list, ElementType findData, ElementType data);

extern void Remove_Front(D_List *list);

extern void Remove_Back(D_List *list);

extern void Remove(D_List *list, ElementType findData);

extern D_ListNode *GetNodeByElement(D_List *list, ElementType findData);

extern D_ListNode *GetNodeByIndex(D_List *list, int index);

extern int SetDataByIndex(D_List *list, int index, ElementType newData);

extern int SetDataByElement(D_List *list, ElementType findData, ElementType newData);

#endif